//123456789*987654321 = ?121932631112635269 
#include <stdio.h>

int main()
{
    int a[] = {1,2,3,4,5,6,7,8,9};
    int b[] = {9,8,7,6,5,4,3,2,1};
    int c[100] = {0};
    
    for(int i = 0; i < 9; i++)
    {
        for(int j = 0; j < 9; j++)
        {
            c[j+i] += b[8-j] * a[8-i];//从后往前取值
        }
        for(int j = 0; j < 100; j++)
        {
            //处理进位问题
            if(c[j] >= 10)
            {
                c[j+1] = c[j+1] + (c[j] / 10);//c[j]的十位为进位与c[j+1]上原有数相加
                c[j] = c[j] % 10;   //取个位
            }
        }
    }

    printf("123456789 * 987654321 = ");
    int flag = 0;
    for(int i = 99; i >= 0; i--)
    {
        if(c[i] != 0)
        flag = 1;
        if(flag == 1)
        printf("%d",c[i]);
    }
    printf("\n");
    return 0;
}
